package com.cn.designpatterns.ex.concrete.backup;

/**
 * @author: zhangyi
 * @date: 2019/1/9 17:29
 * @description:
 */
public class Original {

    private String value;


    public Original(String value) {
        this.value = value;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    /**
     * 创建备份
     *
     * @return
     */
    public Memento createMemento(){
        return new Memento(value);
    }

    /**
     * 恢复数据
     *
     * @param memento
     */
    public void  restoreMenmento(Memento memento){
        this.value = memento.getValue();
    }
}
